import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
import p001 from './p001';
import p002 from './p002';
import p003 from './p003';


interface Par extends Event {
	page_no: number;
}
export default async function a001(fd: IFeidaoAiBrowserComponent,e: Par) {
	const res = await nodejs<{dt: Array<{}>,c: number}>('staff-management/zj-000001/s001',{filter:{pn:e.page_no}});
	// tslint:disable-next-line:variable-name
	const DTp001 =fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p001"]');
	// tslint:disable-next-line:variable-name
	const DTNp002=fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p002"]');
	// tslint:disable-next-line:variable-name
	const DTFp003=fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p003"]');
	if (res.dt.length > 0) {
		render(fd,res.dt,p001,'p001','inner');
		DTNp002.style.display = "none";
		DTp001.style.display = "block";
		DTFp003.style.display = "block";
	} else {
		DTNp002.style.display = "block";
		DTp001.style.display = "none";
		DTFp003.style.display = "none";
		render(fd,"",p002,'p002','inner');
	}
}
